package cn.huihuo.weibo.module;

import com.jfinal.plugin.activerecord.Model;

import java.util.List;

public class Praise extends Model<Praise> {
    public static final Praise praise = new Praise();

    public List<Praise> findByCommentId(String commentId){
        return find("select * from praise t where t.prod_comment_id = ?",commentId);
    }

    /**
     * 一个评论中点赞的只有一个，查询某个商品评论的ID
     * @param commentId
     * @param userId
     * @return
     */
    public Praise findByUserCommentId(String commentId,String userId){
        return findFirst("select * from praise t where t.prod_comment_id = ? and user_id = ?",commentId,userId);
    }



}